<?php

namespace app\admin\model;

use think\Model;


class Fangwu extends Model
{

    

    

    // 表名
    protected $name = 'fangwu';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'zxlx_text',
        'fwlx_text'
    ];
    

    
    public function getZxlxList()
    {
        return ['1' => __('Zxlx 1'), '2' => __('Zxlx 2'), '3' => __('Zxlx 3'), '4' => __('Zxlx 4')];
    }

    public function getFwlxList()
    {
        return ['1' => __('Fwlx 1'), '2' => __('Fwlx 2'), '3' => __('Fwlx 3')];
    }


    public function getZxlxTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['zxlx']) ? $data['zxlx'] : '');
        $list = $this->getZxlxList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getFwlxTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['fwlx']) ? $data['fwlx'] : '');
        $list = $this->getFwlxList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
